package com.swyc.osschat.Test.designMode.interpreter.strategy;

import com.swyc.osschat.Test.designMode.interpreter.base.AbstractExpression;

import com.swyc.osschat.Test.designMode.interpreter.vo.Context;


/**
 * @description 终结表达式角色：加减的数据变量
 * @Author: z156940l@outlook.com
 * @className VariableExpression
 * @Date: 2022/6/27 15:26
 */
public class VariableExpression extends AbstractExpression {
    //声明存储变量名
    private String name;

    public VariableExpression(String name) {
        this.name = name;
    }

    @Override
    public int interpret(Context context) {
        return context.getValue(this);
    }

    @Override
    public String toString() {
        return name;
    }
}
